package com.elhakimz.matra.ui.window;

import com.jmex.bui.*;
import com.jmex.bui.background.TintedBackground;
import com.jmex.bui.layout.GroupLayout;
import com.jme.renderer.ColorRGBA;
import com.jme.system.DisplaySystem;

import java.util.ArrayList;

public class TracksWindow {

    private DisplaySystem display;
    private BDecoratedWindow window;

    public TracksWindow(DisplaySystem display) {
        this.display = display;
        createWindow();

    }

    private void createWindow() {
        window = new BDecoratedWindow(BuiSystem.getStyle(), "");
        window.setBounds(5, display.getHeight() - 350, 200, 300);
        window.setBackground(0, new TintedBackground(ColorRGBA.lightGray));
        window.setAlpha(0.75f);

        BContainer spacer = new BContainer();
        spacer.setBackground(0, new TintedBackground(ColorRGBA.lightGray));
        spacer.setAlpha(0.75f);

        final BTabbedPane pane = new BTabbedPane();
        window.add(pane);

        BContainer cont1 = new BContainer();
        cont1.setBackground(0, new TintedBackground(ColorRGBA.gray));
        cont1.setAlpha(0.75f);

        BContainer cont2 = new BContainer();
        cont2.setBackground(0, new TintedBackground(ColorRGBA.gray));
        cont2.setAlpha(0.75f);

        final GroupLayout glay = GroupLayout.makeVStretch();
        glay.setGap(0);
        BContainer cont = new BContainer(glay);

        pane.addTab("BLUE", cont1);
        pane.addTab("RED", cont2);
        pane.addTab("UNKNOWN", cont);
        pane.getSelectedTab().setColor(ColorRGBA.blue);


        final ArrayList<String> items = new ArrayList<String>();
        for (int ii = 0; ii < 100; ii++) {
            items.add("item " + ii);
        }
        cont.add(new BComboBox(items.toArray()));
        cont.add(new BMenuItem("Three", "three"));
        cont.add(new BMenuItem("Four", "four"));
        cont.add(new BMenuItem("Five", "five"));
        cont.add(new BMenuItem("Six", "six"));
        cont.add(new BMenuItem("Seven", "seven"));
        cont.add(new BMenuItem("Eight", "eight"));
        cont.add(spacer);
        cont.setBackground(0, new TintedBackground(ColorRGBA.gray));
    }

    public void create(){
      BuiSystem.getRootNode().addWindow(window);
    }

    public void show(){
        window.setVisible(true);

    }

    public void hide(){
        window.setVisible(true);
    }


}
